import http from '/@/utils/http';

/**
 * 设备维修管理api接口集合
 * @method addRepairInfoApi 设备内部报修
 * @method repairDetailApi 维修工单详情
 * @method deleteRepairApi 删除维修工单
 * @method closeRepairApi 关闭维修工单
 * @method verifyRepairApi 维修验证
 * @method submitVerifyApi 提交验证
 * @method getDeviceListApi 获取设备下拉框列表（委外报修时用于选择）
 * @method getFailureCategoryApi 获取故障类型下拉框列表
 * @method getFailurePhenomenonApi 获取故障现象下拉框列表
 * @method addFailureTermApi 添加故障项
 * @method deleteFailureTermApi 删除故障项
 * @method editFailureTermApi 修改故障项
 * @method addRepairPartApplyApi 添加备件申请
 * @method addOutsourceRepairApi 添加委外维修
 * @method updateRepairApi 修改工单信息（返回保存当前/维修录入）
 * @method repairDetailByOrderNumApi 根据工单号查询维修工单详情
 * @method repairBatchReportApi 单个/批量导出维修工单
 * @method repairDownloadMouldApi 下载故障项导入模板
 * @method importFailureTermApi 导入故障项
 * @method deletePartApplyDetailApi 备件申请/删除备件申请详情
 * @method repairTransmit 单个维修单转交
 * @method repairBatchTransmit 维修单批量转交
 * @method getRepairUserList 获取原维修人员列表
 */

export const addRepairInfoApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceRepair/addRepairInfo`, params)
}

export const repairDetailApi = async (repairId: any) => {
    return await http.get(`/device/mobile/deviceRepair/repairDetail/${repairId}`)
}

export const deleteRepairApi = async (repairId: any) => {
    return await http.delete(`/device/mobile/deviceRepair/deleteRepair/${repairId}`)
}

export const closeRepairApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceRepair/closeRepair`, params)
}

export const verifyRepairApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceRepair/verifyRepair`, params)
}

export const submitVerifyApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceRepair/submitVerify`, params)
}

export const getDeviceListApi = async () => {
    return await http.get(`/device/mobile/deviceInfo/getOutsourceDeviceList`)
}

export const getFailureCategoryApi = async (deviceType: any) => {
    return await http.get(`/device/mobile/deviceFailureTerm/getFailureCategory/${deviceType}`)
}

export const getFailurePhenomenonApi = async (failureCategoryId: any) => {
    return await http.get(`/device/mobile/deviceFailureTerm/getFailurePhenomenon/${failureCategoryId}`)
}

export const addFailureTermApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceFailureTerm/addFailureTerm`, params)
}

export const deleteFailureTermApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceFailureTerm/deleteFailureTerm/${id}`)
}

export const editFailureTermApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceFailureTerm/editFailureTerm`, params)
}

export const addRepairPartApplyApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceRepair/addRepairPartApply`, params)
}

export const addOutsourceRepairApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceRepair/addOutsourceRepair`, params)
}

export const updateRepairApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceRepair/updateRepair`, params)
}

export const repairDetailByOrderNumApi = async (orderNum: any) => {
    return await http.get(`/device/mobile/deviceRepair/repairDetailByOrderNum/${orderNum}`)
}

export const repairBatchReportApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceRepair/repairBatchReport`, params)
}

export const repairDownloadMouldApi = async () => {
    return await http.postBlob(`/device/mobile/deviceFailureTerm/downloadMould`)
}

export const importFailureTermApi = async (file: any) => {
    return await http.postUpload(`/device/mobile/deviceFailureTerm/importFailureTerm`, file)
}

export const deletePartApplyDetailApi = async (id: any) => {
    return await http.delete(`/device/mobile/devicePartApply/deletePartApplyDetail/${id}`)
}

export const repairTransmit = async (params: any) => {
    return await http.put(`/device/mobile/deviceTransmitRecord/repairTransmit`, params)
}

export const repairBatchTransmit = async (params: any) => {
    return await http.put(`/device/mobile/deviceTransmitRecord/repairBatchTransmit`, params)
}

export const getRepairUserList = async () => {
    return await http.get(`/device/mobile/deviceRepair/getRepairUserList`)
}
